<template>
	<view class="des-opinions">
		<navBar title="维修审核"></navBar>
		<view class="d-remarks">
			<view class="d-text">
				意见审核
			</view>
			<view class="form-item form-item-description">
				<u-textarea v-model="formData.description" placeholder="请输入内容" @blur="inputBlur" confirmType='done'>
				</u-textarea>
				<record class="form-item-icon form-item-icon-voice" @setText="description"></record>
				<image mode="scaleToFill" class="form-item-icon form-item-icon-clear" src="/static/image/login/del1.png"
					@click="formData.description=''"></image>
			</view>
		</view>
		<view class="bottom_btn">
			<!-- <view class="styBtu" @click="choose" >确认</view> -->
			<u-button type="primary" text="确定" @click="choose" :disabled="isClick"></u-button>
		</view>
	</view>
</template>

<script>
	import {
		repairAudit, // 审核
	} from '@/api/engineeringMaintenance/maintenanceTask.js'
	export default {
		name: 'desOpinions',
		data() {
			return {
				formData: {
					description: ''
				},
				data: {},
				isClick:false
			}
		},
		onLoad(params) {
			console.log(params);
			this.data = JSON.parse(params.data)
			console.log(this.data, '2222')
		},
		methods: {
			inputBlur(e) {
				this.cursor = e.detail.cursor
			},
			description(text) {
				let index = this.cursor || 0
				let str = this.formData.description || ""
				this.cursor += text.length
				text = str.slice(0, index) + text + str.slice(index);
				this.$set(this.formData, "description", text)
			},
			choose() {
				this.isClick = true
				let params = {
					// keyword:this.searchText,
					ids: this.data.ids,
					auditStatus: 0,
					auditOption: this.formData.description,
					diseaseOrderId: this.data.diseaseOrderId
				}
				repairAudit(params).then(res => {
					if (res.status === 1 && res.success) {
						uni.showToast({
							title: '提交成功',
							icon: 'none'
						})
					}
				}).finally(() => {
					this.isClick = false
				})
				setTimeout(() => {
					uni.navigateBack({
						delta: 2
					});
				}, 1800)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.des-opinions {
		// height: 100vh;
		/* #ifdef MP-WEIXIN */
			padding-top: 180rpx;
		/* #endif */
		.d-remarks {
			padding-right: 40rpx;
			margin-left: 40rpx;

			.d-text {
				height: 100rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #445469;
				line-height: 100rpx;
			}
		}

		.form-item {
			width: 100%;
			position: relative;
			margin-bottom: 40rpx;
		}

		.form-item-description {
			.form-item-icon {
				width: 48rpx;
				height: 48rpx;
			}

			.form-item-icon-voice {
				position: absolute;
				top: 10rpx;
				right: 16rpx;
				z-index: 3;
			}

			.form-item-icon-clear {
				position: absolute;
				right: 16rpx;
				bottom: 10rpx;
				z-index: 2;
			}
		}
	}

	/deep/.u-textarea {
		padding-right: 65rpx;
	}
	.bottom_btn {
		position: fixed;
		width: 100%;
		bottom: 0;
	}
	.styBtu{
		width: 100%;
		height: 80rpx;
		text-align: center;
		line-height: 80rpx;
		border-radius: 10rpx;
		background-color:#3c9cff ;
		color: #fff;
	}
</style>
